% =========================================================================
% Function to plot all folded spectra in a specified directory
% =========================================================================
function foldAll(dirName)

disp(['Making all fold plots in directory = ' dirName]);

if (exist('dirName/png','dir') == 0) 
    mkdir(dirName,'png');
end
if (exist('dirName/eps','dir') == 0) 
    mkdir(dirName,'eps');
end

files = dir(dirName);
nFiles = length(files);

for file=1:nFiles
    name=files(file).name;
    if (strncmp(name,'speeds',6) == 1)
        continue;
    end
    if (strfind(name, '.dat')-length(name) == -3)
        disp(sprintf('plotting file = %s\n', name));
        foldPlot(name,'./','');
    end
end

end

